<?php
/**
 * Index Controller
 * 
 * @author Nguyen Hai Ha
 * @version 1.0
 */

class Administrator_IndexController extends Zend_Controller_Action {
	protected $_baseUrl;
	protected $_contextPath;
	protected $_utilities;
	protected $_auth;
	
	public function init() {
		$this->_baseUrl = $this->_request->getBaseURL ();
		$this->_contextPath = "administrator/index";
		
		$this->view->assign ( "baseUrl", $this->_baseUrl );
		$this->view->assign ( "contextPath", $this->_contextPath );
		
		$this->_utilities = new Utilities ( );
		$this->view->assign ( "utilities", $this->_utilities );
		
		$this->_auth = Zend_Auth::getInstance ()->getIdentity ();
	}
	
	public function indexAction() {
		$currentRole = $this->_auth->usr_role;
		
		if ($currentRole == Constant::ADMINISTRATOR)
			$this->_redirect ( "administrator/member" );
		else
			$this->_redirect ( "administrator/article" );
	}

}//End class.